<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>用户关系角色管理</title>
    <jsp:include page="../../head.jsp"/>
</head>
<script type="text/javascript">
    var formSetting = {
        title: "用户关系角色管理",
        module: 'save',
        columns: [{
            name: "nAME",
            label: "用户关系角色名称",
            validate: 'validate[required]'
        }, {
            name: "iS_DEFAULT",
            value: "否",
            label: "默认",
            type: "dropdown",
            data: [["是", "是"], ["否", "否"]],
            dropdownValue: "否"
        }, {
            name: "sysBizPermissions",
            type: "checkbox",
            label: "权限列表"
        }, /* {
         name : "supCustomerRole.SYS_ID",
         label : "业务系统用户名",
         validate : 'validate[required]'
         }, {
         name : "supCustomerRole.REMARK",
         label : "备注",
         type : "textarea"
         },/*  {
         name : "supCustomerRole.use_state",
         value:"0",
         label : "使用状态",
         type:"dropdown",
         data:[["启用","0"],["未启用","1"]],
         dropdownValue:"启用"
         }, {
         name : "supCustomerRole.mark",
         label : "备注",
         type : "textarea"
         }, */ {
            name: "iD",
            label: "iD",
            hidden: true
        }, {
            name: "cOM_ID",
            label: "com_id",
            hidden: true
        }],
        form: {
            'url': 'supCustomerRole-saveOrUpdate',
            'data': function () {
                var id = "${id}";
                if (id) {
                    var dataValue = "";
                    $.ajax({
                               url: "supCustomerRole-find?ID=" + id,
                               async: false,
                               success: function (data) {
                                   if (data.IS_DEFAULT == "是") {
                                       var dropdownName = $.mrdForm.getDropDwonLabelName(
                                               "IS_DEFAULT");
                                       data[dropdownName] = data.IS_DEFAULT;
                                   }
                                   dataValue = data;
                               }
                           });
                    return dataValue;
                } else {
                    return null;
                }
            },
            afterAjaxSuccess: function (responseText, statusText, xhr, $form) {
                if ($.parseJSON(responseText.msg).state == 1) {
                    //$('#center', window.parent.document).attr("src","supCustomerRole-main");
                    window.location.href = "supCustomerRole-main";
                }
            }
        },
        buttons: {}
    };
    $(document).ready(function () {
        $("#formtable").mrdForm(formSetting);
    });
</script>
<body>
<div style="width: 100%">
    <div id="formtable"></div>
</div>
</body>
</html>
